package com.jt.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class LogAspect {
    @Pointcut("@annotation(com.jt.annotation.RequiredLog)")
    public void doLog(){}

    @Around("doLog()")
    public Object doAround(ProceedingJoinPoint jp) throws Throwable {
        log.info("Around.Before {}", System.currentTimeMillis());
        Object result = jp.proceed();
        log.info("Around.After {}", System.currentTimeMillis());
        return null;
    }
}
